<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Module: ActiveScaffold::Helpers::Pagination</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Module</strong></td>
          <td class="class-name-in-header">ActiveScaffold::Helpers::Pagination</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/active_scaffold/lib/helpers/pagination_helpers_rb.html">
                vendor/plugins/active_scaffold/lib/helpers/pagination_helpers.rb
                </a>
        <br />
            </td>
        </tr>

        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000265">pagination_ajax_link</a>&nbsp;&nbsp;
      <a href="#M000266">pagination_ajax_links</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000265" class="method-detail">
        <a name="M000265"></a>

        <div class="method-heading">
          <a href="#M000265" class="method-signature">
          <span class="method-name">pagination_ajax_link</span><span class="method-args">(page_number, params)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000265-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000265-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/helpers/pagination_helpers.rb, line 4</span>
 4:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pagination_ajax_link</span>(<span class="ruby-identifier">page_number</span>, <span class="ruby-identifier">params</span>)
 5:         <span class="ruby-identifier">page_link</span> = <span class="ruby-identifier">link_to_remote</span>(<span class="ruby-identifier">page_number</span>,
 6:                   { <span class="ruby-identifier">:url</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page_number</span>),
 7:                     <span class="ruby-identifier">:after</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;$('#{loading_indicator_id(:action =&gt; :pagination)}').style.visibility = 'visible';&quot;</span>,
 8:                     <span class="ruby-identifier">:complete</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;$('#{loading_indicator_id(:action =&gt; :pagination)}').style.visibility = 'hidden';&quot;</span>,
 9:                     <span class="ruby-identifier">:update</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">active_scaffold_content_id</span>,
10:                     <span class="ruby-identifier">:failure</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-node">&quot;ActiveScaffold.report_500_response('#{active_scaffold_id}')&quot;</span>,
11:                     <span class="ruby-identifier">:method</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:get</span> },
12:                   { <span class="ruby-identifier">:href</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">url_for</span>(<span class="ruby-identifier">params</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">:page</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">page_number</span>)) })
13:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000266" class="method-detail">
        <a name="M000266"></a>

        <div class="method-heading">
          <a href="#M000266" class="method-signature">
          <span class="method-name">pagination_ajax_links</span><span class="method-args">(current_page, params)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000266-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000266-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/active_scaffold/lib/helpers/pagination_helpers.rb, line 15</span>
15:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pagination_ajax_links</span>(<span class="ruby-identifier">current_page</span>, <span class="ruby-identifier">params</span>)
16:         <span class="ruby-identifier">start_number</span> = <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>
17:         <span class="ruby-identifier">end_number</span> = <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">+</span> <span class="ruby-value">2</span>
18:         <span class="ruby-identifier">start_number</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">start_number</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span>
19:         <span class="ruby-identifier">end_number</span> = <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">pager</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">number</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">end_number</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">pager</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">number</span>
20: 
21:         <span class="ruby-identifier">html</span> = []
22:         <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">pagination_ajax_link</span>(<span class="ruby-value">1</span>, <span class="ruby-identifier">params</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">3</span>
23:         <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;..&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">4</span>
24:         <span class="ruby-identifier">start_number</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">end_number</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">num</span><span class="ruby-operator">|</span>
25:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">num</span>
26:             <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">num</span>
27:           <span class="ruby-keyword kw">else</span>
28:             <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">pagination_ajax_link</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">params</span>)
29:           <span class="ruby-keyword kw">end</span>
30:         <span class="ruby-keyword kw">end</span>
31:         <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;..&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">pager</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">-</span> <span class="ruby-value">3</span>
32:         <span class="ruby-identifier">html</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">pagination_ajax_link</span>(<span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">pager</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">number</span>, <span class="ruby-identifier">params</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">current_page</span>.<span class="ruby-identifier">pager</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">number</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>
33:         <span class="ruby-identifier">html</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
34:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>